Interface PacketTracerConnection

All Known Implementing Classes:
PacketTracerConnectionImpl

public interface PacketTracerConnection
Manages the socket channel and provides read/write access to the socket channel
Author:
packettracerexapps@external.cisco.com
  • Method Details

    • getHost

      String getHost()
      Returns:
      host name (e.g. localhost)
    • getPort

      int getPort()
      Returns:
      port number (e.g. 39000)
    • connect

      boolean connect()
      Open a socket channel on the specified host:port
      Returns:
      true if connection succeeded
    • reconnect

      boolean reconnect()
    • connectLowLevelReadThread

      void connectLowLevelReadThread()
    • reconnectLowLevelReadThread

      void reconnectLowLevelReadThread()
    • disconnectLowLevelReadThread

      void disconnectLowLevelReadThread()
    • isUp

      boolean isUp()
    • isDown

      boolean isDown()
    • isOpen

      boolean isOpen()
    • getCurrentStatus

      Object getCurrentStatus()
    • getCurrentStatusReason

      String getCurrentStatusReason()
    • getCurrentStatusThrowable

      Throwable getCurrentStatusThrowable()
    • getNextMessage

      ByteBuffer getNextMessage() throws IOException, InterruptedException
      Throws:
      IOException
      InterruptedException
    • noteLowLevelReadError

      void noteLowLevelReadError(Throwable t)
    • disconnect

      void disconnect() throws IOException
      Close the underlying socket channel
      Throws:
      IOException - The exception
    • isConnected

      boolean isConnected()
      Returns true if the underlying socket connection is not null and is connected
      Returns:
      boolean if successful
    • read

      int read(ByteBuffer byteBuffer) throws IOException
      Uses the underlying socket channel to read the byte buffer
      Parameters:
      byteBuffer - ByteBuffer
      Returns:
      number of bytes read
      Throws:
      IOException - The exception
    • write

      int write(ByteBuffer byteBuffer) throws IOException
      Uses the underlying socket channel to write the byte buffer
      Parameters:
      byteBuffer - ByteBuffer
      Returns:
      number of bytes written
      Throws:
      IOException - The exception
    • socketChannel

      SocketChannel socketChannel()
      Returns:
      the underlying socket channel
    • connectionNegotiationProperties

      ConnectionNegotiationProperties connectionNegotiationProperties()
      Returns:
      the connection negotiation properties for this connection